<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg">
  <head>
    <title>Multi-dimensional Arrays</title>
    <link rel="stylesheet" type="text/css" href="docbook-epub.css"/>
    <link rel="stylesheet" type="text/css" href="kawa.css"/>
    <script src="kawa-ebook.js" type="text/javascript"/>
    <meta name="generator" content="DocBook XSL-NS Stylesheets V1.79.1"/>
    <link rel="prev" href="Streams.xhtml" title="Streams - lazy lists"/>
    <link rel="next" href="Hash-tables.xhtml" title="Hash tables"/>
  </head>
  <body>
    <header/>
    <section class="sect1" title="Multi-dimensional Arrays" epub:type="subchapter" id="Arrays">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both">Multi-dimensional Arrays</h2>
          </div>
        </div>
      </div>
      <p>Arrays are heterogeneous data structures that generaize vectors to multiple
indexes or dimensions.  Instead of a single integer index,
there are multiple indexes:  An index is a vector of integers;
the length of a valid index sequence
is the rank or the number of dimensions of an array.
</p>
      <p>Kawa multi-dimensional arrays follows the
by <a class="ulink" href="http://srfi.schemers.org/srfi-25/srfi-25.html" target="_top">SRFI-25 specification</a>,
with additions from Racket’s
<a class="ulink" href="https://docs.racket-lang.org/math/array.html" target="_top">math.array</a> package
and other sources.
</p>
      <p>An array whose rank is 1, and where the (single) lower bound is 0
is a sequence.
Furthermore, if such an array is simple (not created by <code class="literal">share-array</code>)
it will be implemented using a <code class="literal">&lt;vector&gt;</code>.
Uniform vectors and strings are also arrays in Kawa.
</p>
      <p>A rank-0 array has a single value.  It is essentially a box for that
value.  Functions that require arrays may treat non-arrays
as a rank-0 array containing that value.
</p>
      <p>An array of rank 2 is frequently called a <em class="firstterm">matrix</em>.
</p>
      <p>Note that Kawa arrays are distinct from Java (native) arrays.
The latter is a simpler one-dimensional vector-like data structure,
which is used to implement Kawa arrays and vectors.
</p>
      <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873861776" class="indexterm"/> <code class="function">array?</code> <em class="replaceable"><code>obj</code></em></p>
      <div class="blockquote">
        <blockquote class="blockquote">
          <p>Returns <code class="literal">#t</code> if <em class="replaceable"><code>obj</code></em> is an array, otherwise returns <code class="literal">#f</code>.
</p>
        </blockquote>
      </div>
      <section class="sect2" title="Array shape" epub:type="division" id="idm139667873857328">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title">Array shape</h3>
            </div>
          </div>
        </div>
        <p>The <em class="firstterm">shape</em> of an array consists of bounds for each index.
</p>
        <p>The lower bound <em class="replaceable"><code>b</code></em> and the upper bound <em class="replaceable"><code>e</code></em> of a dimension are
exact integers with <code class="literal">(&lt;= <em class="replaceable"><code>b</code></em> <em class="replaceable"><code>e</code></em>)</code>. A valid index along the
dimension is an exact integer <em class="replaceable"><code>i</code></em> that satisfies both
<code class="literal">(&lt;= <em class="replaceable"><code>b</code></em> <em class="replaceable"><code>i</code></em>)</code> and <code class="literal">(&lt; <em class="replaceable"><code>i</code></em> <em class="replaceable"><code>e</code></em>)</code>.
The length of the array along the dimension is the difference
<code class="literal">(- <em class="replaceable"><code>e</code></em> <em class="replaceable"><code>b</code></em>)</code>.
The size of an array is the product of the lengths of its dimensions.
</p>
        <p>A procedure that requires a <em class="replaceable"><code>shape</code></em> accepts any of the following:
</p>
        <div class="itemizedlist" epub:type="list">
          <ul class="itemizedlist" style="list-style-type: disc; ">
            <li class="listitem" epub:type="list-item">
              <p>A vector of simple <a class="link" href="Ranges.xhtml" title="Ranges">ranges</a>, one for each
dimension, all of who are
bounded (finite), consist of integer values,
and have a <em class="replaceable"><code>step</code></em> of 1.
Each range, which is usually written as <code class="literal">[<em class="replaceable"><code>b</code></em> &lt;: <em class="replaceable"><code>e</code></em>]</code>,
expresses the bounds of the corresponding dimension.
For example <code class="literal">[[0 &lt;: 5] [2 &lt;=: 6]]</code> is the shape
of a rank-2 array, where the first index can be from 0 to 5 (exclusive),
while the second index can be from 2 to 6 (inclusive).
</p>
            </li>
            <li class="listitem" epub:type="list-item">
              <p>A vector of simple integers.
Each integer <em class="replaceable"><code>e</code></em> is an upper bound,
and is equivalent to the range <code class="literal">[0 &lt;: <em class="replaceable"><code>e</code></em>]</code>.
</p>
            </li>
            <li class="listitem" epub:type="list-item">
              <p>A vector consisting of a mix of integers and ranges.
</p>
            </li>
            <li class="listitem" epub:type="list-item">
              <p>A rank-2 array <em class="replaceable"><code>S</code></em> whose own shape is <code class="literal">[<em class="replaceable"><code>r</code></em> 2]</code>.
For each dimension <em class="replaceable"><code>k</code></em>
(where <code class="literal">(&lt;= <em class="replaceable"><code>k</code></em> 0)</code> and <code class="literal">(&lt; <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>r</code></em>)</code>),
the lower bound <em class="replaceable"><code>b<sub>k</sub></code></em> is <code class="literal">(S <em class="replaceable"><code>k</code></em> 0)</code>,
and the upper bound <em class="replaceable"><code>e<sub>k</sub></code></em> is <code class="literal">(S <em class="replaceable"><code>k</code></em> 1)</code>.
</p>
            </li>
          </ul>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873833760" class="indexterm"/> <code class="function">shape</code> <em class="replaceable"><code>bound</code></em> <em class="replaceable"><code>...</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Returns a shape. The sequence <em class="replaceable"><code>bound</code></em> ... must consist of an even number
of exact integers that are pairwise not decreasing. Each pair gives the
lower and upper bound of a dimension.
If the shape is used to specify the dimensions of an array
and <em class="replaceable"><code>bound</code></em> ... is the sequence <em class="replaceable"><code>b0</code></em> <em class="replaceable"><code>e0</code></em> ... <em class="replaceable"><code>bk</code></em> <em class="replaceable"><code>ek</code></em>
... of <em class="replaceable"><code>n</code></em> pairs of bounds, then a valid index to the array is any
sequence <em class="replaceable"><code>j0</code></em> ... <em class="replaceable"><code>jk</code></em> ... of <em class="replaceable"><code>n</code></em> exact integers where
each <em class="replaceable"><code>jk</code></em> satisfies <code class="literal">(&lt;= <em class="replaceable"><code>bk</code></em> <em class="replaceable"><code>jk</code></em>)</code>
and <code class="literal">(&lt; <em class="replaceable"><code>jk</code></em> <em class="replaceable"><code>ek</code></em>)</code>.
</p>
            <p>The shape of a <em class="replaceable"><code>d</code></em>-dimensional array is a <em class="replaceable"><code>d</code></em> * 2 array
where the element at <em class="replaceable"><code>k 0</code></em> contains the lower bound for an index along
dimension <em class="replaceable"><code>k</code></em> and the element at <em class="replaceable"><code>k 1</code></em> contains the
corresponding upper bound, where <em class="replaceable"><code>k</code></em> satisfies <code class="literal">(&lt;=  0 <em class="replaceable"><code>k</code></em>)</code>
and <code class="literal">(&lt; <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>d</code></em>)</code>.
</p>
            <p><code class="literal">(shape @<em class="replaceable"><code>bounds</code></em>)</code>
is equivalent to:
<code class="literal">(array [2 (/ (length <em class="replaceable"><code>bounds</code></em>) 2)] @<em class="replaceable"><code>bounds</code></em>)</code>
</p>
          </blockquote>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873815040" class="indexterm"/> <code class="function">array-rank</code> <em class="replaceable"><code>array</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Returns the number of dimensions of <em class="replaceable"><code>array</code></em>.
</p>
            <pre class="screen">(array-rank
  (make-array (shape 1 2 3 4)))
</pre>
            <p>Returns 2.
</p>
          </blockquote>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873810624" class="indexterm"/> <code class="function">array-start</code> <em class="replaceable"><code>array</code></em> <em class="replaceable"><code>k</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Returns the lower bound (inclusive) for the index along dimension <em class="replaceable"><code>k</code></em>.
This is most commonly 0.
</p>
          </blockquote>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873806384" class="indexterm"/> <code class="function">array-end</code> <em class="replaceable"><code>array</code></em> <em class="replaceable"><code>k</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Returns the upper bound for the index along dimension <em class="replaceable"><code>k</code></em>.
The bound is exclusive - i.e. the first integer higher
than the last legal index.
</p>
          </blockquote>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873802112" class="indexterm"/> <code class="function">array-size</code> <em class="replaceable"><code>array</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Return the total number of elements of <em class="replaceable"><code>array</code></em>.
This is the product of <code class="literal">(- (array-end <em class="replaceable"><code>array</code></em> <em class="replaceable"><code>k</code></em>) (array-start <em class="replaceable"><code>array</code></em> <em class="replaceable"><code>k</code></em>))</code> for every valid <em class="replaceable"><code>k</code></em>.
</p>
          </blockquote>
        </div>
      </section>
      <section class="sect2" title="Array types" epub:type="division" id="idm139667873795792">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title">Array types</h3>
            </div>
          </div>
        </div>
        <p class="synopsis" kind="Type"><span class="kind">Type</span><span class="ignore">: </span><a id="idm139667873794720" class="indexterm"/> <code class="function">array</code></p>
        <p class="synopsis" kind="Type"><span class="kind">Type</span><span class="ignore">: </span><a id="idm139667873792304" class="indexterm"/> <code class="function">array<em class="replaceable"><code>N</code></em></code></p>
        <p class="synopsis" kind="Type"><span class="kind">Type</span><span class="ignore">: </span><a id="idm139667873789376" class="indexterm"/> <code class="function">array[<em class="replaceable"><code>etype</code></em>]</code></p>
        <p class="synopsis" kind="Type"><span class="kind">Type</span><span class="ignore">: </span><a id="idm139667873786128" class="indexterm"/> <code class="function">array<em class="replaceable"><code>N</code></em>[<em class="replaceable"><code>etype</code></em>]</code></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>The type <code class="literal">array</code> matches all array values.
The type <code class="literal">array<em class="replaceable"><code>N</code></em></code>, where <em class="replaceable"><code>N</code></em> is an integer
matches array of rank <em class="replaceable"><code>N</code></em>.
For example <code class="literal">array2</code> matches rank-2 array - i.e. matrixes.
</p>
            <p>You can optionally specify the element type <em class="replaceable"><code>etype</code></em>.
This can be a primitive type.
For example a <code class="literal">array2[double]</code> is a rank-2 array
whose elements are <code class="literal">double</code> values.
</p>
          </blockquote>
        </div>
        <span id="array-literals"/>
      </section>
      <section class="sect2" title="Array literals and printing" epub:type="division" id="idm139667873776720">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title">Array literals and printing</h3>
            </div>
          </div>
        </div>
        <p>An array literal starts with <code class="literal">#</code> followed by its rank,
followed by a tag that describes the underlying vector (by default <code class="literal">a</code>),
optionally followed by information about its shape,
and finally followed by the cells, organized into dimensions using parentheses.
</p>
        <p>For example, <code class="literal">#2a((11 12 13) (21 22 23))</code> is a rank-2 array (a matrix)
whose shape is <code class="literal">[2 3]</code> or equivalently <code class="literal">[[0 &lt;: 2] [0 &lt;: 3]]</code>.
It is pretty-printed as:
</p>
        <pre class="screen">╔#2a:2:3═╗
║11│12│13║
╟──┼──┼──╢
║21│22│23║
╚══╧══╧══╝
</pre>
        <div class="literallayout">
          <p><a id="idm139667873771952" class="indexterm"/><span id="meta-array-literal"/><em class="replaceable"><code>array-literal</code></em> <code class="literal">::=</code> <a class="link" href="Arrays.xhtml#meta-array-literal-header"><em class="replaceable"><code>array-literal-header</code></em></a> <a class="link" href="Datum-syntax.xhtml#meta-datum"><em class="replaceable"><code>datum</code></em></a><br/>
<a id="idm139667873768320" class="indexterm"/><span id="meta-array-literal-header"/><em class="replaceable"><code>array-literal-header</code></em> <code class="literal">::=</code> <code class="literal"><span class="bold"><strong>#</strong></span></code> <em class="replaceable"><code>rank</code></em> <a class="link" href="Arrays.xhtml#meta-vectag"><em class="replaceable"><code>vectag</code></em></a> <a class="link" href="Arrays.xhtml#meta-array-bound"><em class="replaceable"><code>array-bound</code></em></a><sup>*</sup> <br/>
<a id="idm139667873763232" class="indexterm"/><span id="meta-array-bound"/><em class="replaceable"><code>array-bound</code></em> <code class="literal">::=</code> [<code class="literal"><span class="bold"><strong>@</strong></span></code><em class="replaceable"><code>lower</code></em>]<code class="literal"><span class="bold"><strong>:</strong></span></code><em class="replaceable"><code>length</code></em> | <code class="literal"><span class="bold"><strong>@</strong></span></code><em class="replaceable"><code>lower</code></em><br/>
<a id="idm139667873758032" class="indexterm"/><span id="meta-vectag"/><em class="replaceable"><code>vectag</code></em> <code class="literal">::=</code> <code class="literal"><span class="bold"><strong>a</strong></span></code> | <a class="link" href="Uniform-vectors.xhtml#meta-uniform-tag"><em class="replaceable"><code>uniform-tag</code></em></a><br/>
</p>
        </div>
        <p>The <em class="replaceable"><code>vectag</code></em> specifies the type of the elements of the array.
</p>
        <p>Following the <em class="replaceable"><code>vectag</code></em> you can optionally include information
about the shape: For each dimension you can optionally specify
the lower bounds (after the character <code class="literal">"@"</code>),
followed by the length of the dimension (after the character <code class="literal">":"</code>).
The shape information is required if a lower bound is non-zero,
or any length is zero.
</p>
        <p>The <a class="link" href="Datum-syntax.xhtml#meta-datum"><em class="replaceable"><code>datum</code></em></a> contains the elements in a nested-list format:
a rank-1 array (i.e. vector) uses a single list,
a rank-2 array uses a list-of-listrs, and so on.
The elements are in lexicographic order.
</p>
        <p>A uniform u32 array of rank 2 with index ranges 2..3 and 3..4:
</p>
        <pre class="screen">#2u32@2@3((1 2) (2 3))
</pre>
        <p>This syntax follow Common Lisp with
<a class="ulink" href="https://www.gnu.org/software/guile/manual/html_node/Array-Syntax.html" target="_top">Guile
extensions</a>.  (Note that Guile prints rank-0 arrays with an extra
set of parentheses.  Kawa follows Common Lisp in not doing so.)
</p>
        <p>When an array is printed with the <code class="literal">write</code> function,
the result is an <code class="literal">array-literal</code>.
Printing with <code class="literal">display</code> formats the array in a rectangular grid
using the <code class="literal">format-array</code> procedure.
(Note that <code class="literal">format-array</code> is only used when the output is in column 0,
because Kawa has very limited support for printing rectangles.)
</p>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873744976" class="indexterm"/> <code class="function">format-array</code> <em class="replaceable"><code>value</code></em> [<em class="replaceable"><code>element-format</code></em>]</p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Produce a nice “pretty” display for <em class="replaceable"><code>value</code></em>, which is usually an array.
</p>
            <p>The top line includes an <code class="literal">array-literal-header</code>.
The lower bound are only printed if non-zero.
The dimension lengths are printed if there is zoom, or if one of them is zero.
</p>
            <pre class="screen">#|kawa:34|# (! arr (array [[1 &lt;=: 2] [1 &lt;=: 3]]
#|.....35|#   #2a((1 2) (3 4)) 9 #2a((3 4) (5 6))
#|.....36|#   [42 43] #2a:1:3((8 7 6)) #2a((90 91) (100 101))))
#|kawa:37|# arr
╔#2a@1:2@1:3════╤═════════╗
║#2a═╗  │      9│#2a═╗    ║
║║1│2║  │       │║3│4║    ║
║╟─┼─╢  │       │╟─┼─╢    ║
║║3│4║  │       │║5│6║    ║
║╚═╧═╝  │       │╚═╧═╝    ║
╟───────┼───────┼─────────╢
║╔#1a:2╗│#2a:1:3│╔#2a:2:2╗║
║║42│43║│║8│7│6║│║ 90│ 91║║
║╚══╧══╝│╚═╧═╧═╝│╟───┼───╢║
║       │       │║100│101║║
║       │       │╚═══╧═══╝║
╚═══════╧═══════╧═════════╝
</pre>
            <p>If <em class="replaceable"><code>element-format</code></em> is specified, it is a format string used
for format each non-array:
</p>
            <pre class="screen">#|kawa:38|# (format-array arr "~4,2f")
╔#2a@1:2@1:3══╤════════════════╤═══════════════╗
║╔#2a:2:2══╗  │            9.00│╔#2a:2:2══╗    ║
║║1.00│2.00║  │                │║3.00│4.00║    ║
║╟────┼────╢  │                │╟────┼────╢    ║
║║3.00│4.00║  │                │║5.00│6.00║    ║
║╚════╧════╝  │                │╚════╧════╝    ║
╟─────────────┼────────────────┼───────────────╢
║╔#1a:2╤═════╗│╔#2a:1:3══╤════╗│╔#2a:2:2══════╗║
║║42.00│43.00║│║8.00│7.00│6.00║│║ 90.00│ 91.00║║
║╚═════╧═════╝│╚════╧════╧════╝│╟──────┼──────╢║
║             │                │║100.00│101.00║║
║             │                │╚══════╧══════╝║
╚═════════════╧════════════════╧═══════════════╝
</pre>
            <p>If the rank is more than 2, then each “layer”
is printed separated by double lines.
</p>
            <pre class="screen">#|kawa:42|# (array-reshape [1 &lt;=: 24] [3 2 4])
╔#3a:3:2:4══╗
║ 1│ 2│ 3│ 4║
╟──┼──┼──┼──╢
║ 5│ 6│ 7│ 8║
╠══╪══╪══╪══╣
║ 9│10│11│12║
╟──┼──┼──┼──╢
║13│14│15│16║
╠══╪══╪══╪══╣
║17│18│19│20║
╟──┼──┼──┼──╢
║21│22│23│24║
╚══╧══╧══╧══╝
</pre>
          </blockquote>
        </div>
      </section>
      <section class="sect2" title="Array construction" epub:type="division" id="idm139667873733232">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title">Array construction</h3>
            </div>
          </div>
        </div>
        <p>See also <code class="literal">array-reshape</code>
</p>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873731328" class="indexterm"/> <code class="function">array</code> <em class="replaceable"><code>shape</code></em> <em class="replaceable"><code>obj</code></em> <em class="replaceable"><code>...</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Returns a new array whose shape is given by <em class="replaceable"><code>shape</code></em> and the initial
contents of the elements are <em class="replaceable"><code>obj</code></em> ... in row major order. The array does
not retain a reference to <em class="replaceable"><code>shape</code></em>.
</p>
          </blockquote>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873725792" class="indexterm"/> <code class="function">make-array</code> <em class="replaceable"><code>shape</code></em></p>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873722960" class="indexterm"/> <code class="function">make-array</code> <em class="replaceable"><code>shape</code></em> <em class="replaceable"><code>value...</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Returns a newly allocated array whose shape is given by <em class="replaceable"><code>shape</code></em>.
If <em class="replaceable"><code>value</code></em> is provided, then each element is initialized to it.
If there is more than one <em class="replaceable"><code>value</code></em>, they are used in order, starting
over then the <em class="replaceable"><code>value</code></em>s are exhausted.
If there is no <em class="replaceable"><code>value</code></em>, the initial contents of each element is
unspecified.  (Actually, it is the <code class="literal">#!null</code>.)
The array does not retain a reference to <em class="replaceable"><code>shape</code></em>.
</p>
            <pre class="screen"><span class="prompt">#|kawa:16|# </span><strong class="userinput"><code>(make-array [2 4] 1 2 3 4 5)</code></strong>
╔#2a:2:4╗
║1│2│3│4║
╟─┼─┼─┼─╢
║5│1│2│3║
╚═╧═╧═╧═╝
</pre>
            <p><span class="emphasis"><em>Compatibility:</em></span> Guile has an incompatible <code class="literal">make-array</code> procedure.
</p>
          </blockquote>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873713424" class="indexterm"/> <code class="function">build-array</code> <em class="replaceable"><code>shape</code></em> <em class="replaceable"><code>procedure</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Construct a “virtual array” of the given <em class="replaceable"><code>shape</code></em>,
which uses no storage for the elements.
Instead, elements are calculated on-demand by calling <em class="replaceable"><code>procedure</code></em>,
which takes a single argument, an index vector.
</p>
            <p>There is no caching or memoization.
</p>
            <pre class="screen"><span class="prompt">#|kawa:1|# </span><strong class="userinput"><code>(build-array [[10 &lt;: 12] 3]</code></strong>
<span class="prompt">#|....:2|# </span><strong class="userinput"><code>  (lambda (ind)</code></strong>
<span class="prompt">#|....:3|# </span><strong class="userinput"><code>    (let ((x (ind 0)) (y (ind 1)))</code></strong>
<span class="prompt">#|....:4|# </span><strong class="userinput"><code>      (- x y))))</code></strong>
#2a@10:2:3
║10│ 9│8║
╟──┼──┼─╢
║11│10│9║
╚══╧══╧═╝
</pre>
          </blockquote>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873704784" class="indexterm"/> <code class="function">index-array</code> <em class="replaceable"><code>shape</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Return a new immutable array of the specified <em class="replaceable"><code>shape</code></em>
where each element is the corresponding row-major index.
Same as <code class="literal">(array-reshape [0 &lt;: <em class="replaceable"><code>size</code></em>] <em class="replaceable"><code>shape</code></em>)</code>
where <em class="replaceable"><code>size</code></em> is the <code class="literal">array-size</code> of the resulting array.
</p>
            <pre class="screen"><span class="prompt">#|kawa:1|# </span><strong class="userinput"><code>(index-array [[1 &lt;: 3] [2 &lt;: 6]])</code></strong>
#2a@1:2@2:4
║0│1│2│3║
╟─┼─┼─┼─╢
║4│5│6│7║
╚═╧═╧═╧═╝
</pre>
          </blockquote>
        </div>
      </section>
      <section class="sect2" title="Array indexing" epub:type="division" id="idm139667873697328">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title">Array indexing</h3>
            </div>
          </div>
        </div>
        <p>If you “call” an array as it it were a function,
it is equivalent to using <code class="literal">array-index-ref</code>,
which is generalization of <code class="literal">array-ref</code>.
For example, given a rank-2 array <em class="replaceable"><code>arr</code></em> with integer indexes <em class="replaceable"><code>i</code></em>
and <em class="replaceable"><code>j</code></em>, the following all get the element of <em class="replaceable"><code>arr</code></em>
at index <code class="literal">[<em class="replaceable"><code>i</code></em> <em class="replaceable"><code>j</code></em>]</code>.
</p>
        <pre class="screen">(<em class="replaceable"><code>arr</code></em> <em class="replaceable"><code>i</code></em> <em class="replaceable"><code>j</code></em>)
(array-index-ref <em class="replaceable"><code>arr</code></em> <em class="replaceable"><code>i</code></em> <em class="replaceable"><code>j</code></em>)
(array-ref <em class="replaceable"><code>arr</code></em> <em class="replaceable"><code>i</code></em> <em class="replaceable"><code>j</code></em>)
(array-ref <em class="replaceable"><code>arr</code></em> [<em class="replaceable"><code>i</code></em> <em class="replaceable"><code>j</code></em>])
</pre>
        <p>Using function-call notation or <code class="literal">array-index-ref</code>
(but not plain <code class="literal">array-ref</code>) you can do generalized APL-style
slicing and indirect indexing.
See under <code class="literal">array-index-ref</code> for examples.
</p>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873685136" class="indexterm"/> <code class="function">array-ref</code> <em class="replaceable"><code>array</code></em> <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>...</code></em></p>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873681536" class="indexterm"/> <code class="function">array-ref</code> <em class="replaceable"><code>array</code></em> <em class="replaceable"><code>index</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Returns the contents of the element of <em class="replaceable"><code>array</code></em> at index <em class="replaceable"><code>k</code></em> ....
The sequence <em class="replaceable"><code>k</code></em> ... must be a valid index to <em class="replaceable"><code>array</code></em>.
In the second form, <em class="replaceable"><code>index</code></em> must be either a vector
(a 0-based 1-dimensional array) containing <em class="replaceable"><code>k</code></em> ....
</p>
            <pre class="screen">(array-ref (array [2 3]
              'uno 'dos 'tres
              'cuatro 'cinco 'seis)
   1 0)
</pre>
            <p>Returns <code class="literal">cuatro</code>.
</p>
            <pre class="screen">(let ((a (array (shape 4 7 1 2) 3 1 4)))
   (list (array-ref a 4 1)
         (array-ref a (vector 5 1))
         (array-ref a (array (shape 0 2)
                         6 1))))
</pre>
            <p>Returns <code class="literal">(3 1 4)</code>.
</p>
          </blockquote>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873672848" class="indexterm"/> <code class="function">array-index-ref</code> <em class="replaceable"><code>array</code></em> <em class="replaceable"><code>index</code></em> <em class="replaceable"><code>...</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Generalized APL-style array indexing, where each <em class="replaceable"><code>index</code></em>
can be either an array or an integer.
</p>
            <p>If each <em class="replaceable"><code>index</code></em> is an integer, then the result is the same as <code class="literal">array-ref</code>.
</p>
            <p>Otherwise, the result is an immutable array whose rank is the sum of the ranks of
each <em class="replaceable"><code>index</code></em>.  An integer is treated as rank-0 array.
</p>
            <p>If <em class="replaceable"><code>marr</code></em> is the result of <code class="literal">(array-index-ref <em class="replaceable"><code>arr</code></em> <em class="replaceable"><code>M<sub>1</sub></code></em> <em class="replaceable"><code>M<sub>2</sub></code></em> ...)</code> then:
</p>
            <pre class="screen">(<em class="replaceable"><code>marr</code></em> <em class="replaceable"><code>i<sub>11</sub></code></em> <em class="replaceable"><code>i<sub>12</sub></code></em> ... <em class="replaceable"><code>i<sub>21</sub></code></em> <em class="replaceable"><code>i<sub>22</sub></code></em> ...)
</pre>
            <p>is defined as:
</p>
            <pre class="screen">(<em class="replaceable"><code>arr</code></em> (<em class="replaceable"><code>M<sub>1</sub></code></em> <em class="replaceable"><code>i<sub>11</sub></code></em> <em class="replaceable"><code>i<sub>12</sub></code></em> ...) (<em class="replaceable"><code>M<sub>2</sub></code></em> <em class="replaceable"><code>i<sub>21</sub></code></em> <em class="replaceable"><code>i<sub>22</sub></code></em> ...) ...)
</pre>
            <p>Each <em class="replaceable"><code>M<sub>k</sub></code></em> gets as many indexes as its rank.
If <em class="replaceable"><code>M<sub>k</sub></code></em> is an integer, then it we use
it directly without any indexing.
</p>
            <p>Here are some examples, starting with simple indexing.
</p>
            <pre class="screen">#|kawa:1|# (define arr (array #2a((1 4) (0 4))
#|.....2|#                    10 11 12 13 20 21 22 23 30 31 32 33))
#|kawa:3|# arr
╔#2a@1:3:4══╗
║10│11│12│13║
╟──┼──┼──┼──╢
║20│21│22│23║
╟──┼──┼──┼──╢
║30│31│32│33║
╚══╧══╧══╧══╝
#|kawa:4|# (arr 2 3)
23
</pre>
            <p>If one index is a vector and the rest are scalar integers,
then the result is a vector:
</p>
            <pre class="screen">#|kawa:5|# (arr 2 [3 1])
#(23 21)
</pre>
            <p>You can select a “sub-matrix” when all indexes are vectors:
</p>
            <pre class="screen">#|kawa:6|# (arr [2 1] [3 1 3])
╔#2a:2:3═╗
║23│21│23║
╟──┼──┼──╢
║13│11│13║
╚══╧══╧══╝
</pre>
            <p>Using ranges for index vectors selects a rectangular sub-matrix.
</p>
            <pre class="screen">#|kawa:7|# (arr [1 &lt;: 3] [1 &lt;: 4])
╔#2a:2:3═╗
║11│12│13║
╟──┼──┼──╢
║21│22│23║
╚══╧══╧══╝
</pre>
            <p>You can add new dimensions:
</p>
            <pre class="screen">#|kawa:8|# (arr [2 1] #2a((3 1) (3 2)))
#3a╤══╗
║23│21║
╟──┼──╢
║23│22║
╠══╪══╣
║13│11║
╟──┼──╢
║13│12║
╚══╧══╝
</pre>
            <p>The pseudo-range <code class="literal">[&lt;:]</code> can be used to select all the indexes
along a dimension.  To select row 2 (1-origin):
</p>
            <pre class="screen">#|kawa:9|# (arr 2 [&lt;:])
#(20 21 22 23)
</pre>
            <p>To reverse the order use <code class="literal">[&gt;:]</code>:
</p>
            <pre class="screen">#|kawa:10|# (arr 2 [&gt;:])
#(23 22 21 20)
</pre>
            <p>To select column 3:
</p>
            <pre class="screen">#|kawa:11|# (arr [&lt;:] 3)
#(13 23 33)
</pre>
            <p>If you actually want a column matrix (i.e. with shape <code class="literal">[3 1]</code>
you can write can place the index in a single-element vector:
</p>
            <pre class="screen">#|kawa:12|# (arr [&lt;:] [3])
#2a╗
║13║
╟──╢
║23║
╟──╢
║33║
╚══╝
</pre>
            <p>To expand that column to 5 colums you can repeat the column index:
</p>
            <pre class="screen">#|kawa:13|# [3 by: 0 size: 5]
#(3 3 3 3 3)
#|kawa:14|# (arr [&lt;:] [3 by: 0 size: 5])
╔#2a:3:5═╤══╤══╗
║13│13│13│13│13║
╟──┼──┼──┼──┼──╢
║23│23│23│23│23║
╟──┼──┼──┼──┼──╢
║33│33│33│33│33║
╚══╧══╧══╧══╧══╝
</pre>
          </blockquote>
        </div>
      </section>
      <section class="sect2" title="Modifying arrays" epub:type="division" id="idm139667873642576">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title">Modifying arrays</h3>
            </div>
          </div>
        </div>
        <p>You can use <code class="literal">set!</code> to modify one or multiple elements.
To modify a single element:
</p>
        <pre class="screen">(set! (<em class="replaceable"><code>arr</code></em> <em class="replaceable"><code>index</code></em> ...) <em class="replaceable"><code>new-value</code></em>)
</pre>
        <p>is equivalent to
</p>
        <pre class="screen">(array-set! <em class="replaceable"><code>arr</code></em> <em class="replaceable"><code>index</code></em> ... <em class="replaceable"><code>new-value</code></em>)
</pre>
        <p>You can set a slice (or all of the elements).
In that case:
</p>
        <pre class="screen">(set! (<em class="replaceable"><code>arr</code></em> <em class="replaceable"><code>index</code></em> ...) <em class="replaceable"><code>new-array</code></em>)
</pre>
        <p>is equivalent to:
</p>
        <pre class="screen">(array-copy! (array-index-share <em class="replaceable"><code>arr</code></em> <em class="replaceable"><code>index</code></em> ...) <em class="replaceable"><code>new-array</code></em>)
</pre>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873633520" class="indexterm"/> <code class="function">array-set!</code> <em class="replaceable"><code>array</code></em> <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>...</code></em> <em class="replaceable"><code>obj</code></em></p>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873629536" class="indexterm"/> <code class="function">array-set!</code> <em class="replaceable"><code>array</code></em> <em class="replaceable"><code>index</code></em> <em class="replaceable"><code>obj</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Stores <em class="replaceable"><code>obj</code></em> in the element of <em class="replaceable"><code>array</code></em> at index <em class="replaceable"><code>k</code></em> ....
Returns the void value.
The sequence <em class="replaceable"><code>k</code></em> ... must be a valid index to <em class="replaceable"><code>array</code></em>.
In the second form, <em class="replaceable"><code>index</code></em> must be either a vector or a
0-based 1-dimensional array containing <em class="replaceable"><code>k</code></em> ....
</p>
            <pre class="screen">(let ((a (make-array
            (shape 4 5 4 5 4 5))))
   (array-set! a 4 4 4 "huuhkaja")
   (array-ref a 4 4 4))
</pre>
            <p>Returns <code class="literal">"huuhkaja"</code>.
</p>
            <p><span class="emphasis"><em>Compatibility:</em></span> SRFI-47, Guile and Scheme-48 have <code class="literal">array-set!</code> with a
different argument order.
</p>
          </blockquote>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873619808" class="indexterm"/> <code class="function">array-copy!</code> <em class="replaceable"><code>dst</code></em> <em class="replaceable"><code>src</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p><span class="emphasis"><em>Compatibility:</em></span> Guile has a <code class="literal">array-copy!</code> with the reversed
argument order.
</p>
          </blockquote>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873615328" class="indexterm"/> <code class="function">array-fill!</code> <em class="replaceable"><code>array</code></em> <em class="replaceable"><code>value</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Set all the values <em class="replaceable"><code>array</code></em> to <em class="replaceable"><code>value</code></em>.
</p>
          </blockquote>
        </div>
      </section>
      <section class="sect2" title="Transformations and views" epub:type="division" id="idm139667873610672">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title">Transformations and views</h3>
            </div>
          </div>
        </div>
        <p>A view or transform of an array is an array <em class="replaceable"><code>a<sub>2</sub></code></em>
whose elements come from some other array <em class="replaceable"><code>a<sub>1</sub></code></em>,
given some transform function <em class="replaceable"><code>T</code></em> that maps <em class="replaceable"><code>a<sub>2</sub></code></em> indexes
to <em class="replaceable"><code>a<sub>1</sub></code></em> indexes.
Specifically <code class="literal">(array-ref <em class="replaceable"><code>a<sub>2</sub></code></em> <em class="replaceable"><code>indexes</code></em>)</code>
is <code class="literal">(array-ref <em class="replaceable"><code>a<sub>1</sub></code></em> (<em class="replaceable"><code>T</code></em> <em class="replaceable"><code>indexes</code></em>))</code>.
Modifying <em class="replaceable"><code>a<sub>2</sub></code></em> causes <em class="replaceable"><code>a<sub>1</sub></code></em> to be modified;
modifying <em class="replaceable"><code>a<sub>1</sub></code></em> may modify <em class="replaceable"><code>a<sub>2</sub></code></em>
(depending on the transform function).
The shape of <em class="replaceable"><code>a<sub>2</sub></code></em> is in generally different than that of <em class="replaceable"><code>a<sub>1</sub></code></em>.
</p>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873598512" class="indexterm"/> <code class="function">array-transform</code> <em class="replaceable"><code>array</code></em> <em class="replaceable"><code>shape</code></em> <em class="replaceable"><code>transform</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>This is a general mechanism for creating a view.
The result is a new array with the given <em class="replaceable"><code>shape</code></em>.
Accessing this new array is implemented by calling the <em class="replaceable"><code>transform</code></em>
function on the index vector, which must return a new index vector
valid for indexing the original <em class="replaceable"><code>array</code></em>.
Here is an example (using the same <code class="literal">arr</code> as in
the <code class="literal">array-index-ref</code> example):
</p>
            <pre class="screen">#|kawa:1|# (define arr (array #2a((1 4) (0 4))
#|.....2|#                    10 11 12 13 20 21 22 23 30 31 32 33))
#|kawa:14|# (array-transform arr #2a((0 3) (1 3) (0 2))
#|.....15|#   (lambda (ix) (let ((i (ix 0)) (j (ix 1)) (k (ix 2)))
#|.....16|#                  [(+ i 1)
#|.....17|#                   (+ (* 2 (- j 1)) k)])))
#3a:3@1:2:2
║10│11║
╟──┼──╢
║12│13║
╠══╪══╣
║20│21║
╟──┼──╢
║22│23║
╠══╪══╣
║30│31║
╟──┼──╢
║32│33║
╚══╧══╝
</pre>
            <p>The <code class="literal">array-transform</code> is generalization of <code class="literal">share-array</code>,
in that it does not require the <em class="replaceable"><code>transform</code></em> to be affine.
Also note the different calling conversions for the <em class="replaceable"><code>tranform</code></em>:
<code class="literal">array-transform</code> takes a single argument (a vector of indexes),
and returns a single result (a vector of indexes);
<code class="literal">share-array</code> takes one argument for each index, and returns
one value for each index.  The difference is historical.
</p>
          </blockquote>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873587168" class="indexterm"/> <code class="function">array-index-share</code> <em class="replaceable"><code>array</code></em> <em class="replaceable"><code>index</code></em> <em class="replaceable"><code>...</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>This does the same generalized APL-style indexing
as <code class="literal">array-index-ref</code>.  However, the resulting array
is a modifiable view into argument <em class="replaceable"><code>array</code></em>.
</p>
          </blockquote>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873582048" class="indexterm"/> <code class="function">array-reshape</code> <em class="replaceable"><code>array</code></em> <em class="replaceable"><code>shape</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Creates a new array <em class="replaceable"><code>narray</code></em> of the given <em class="replaceable"><code>shape</code></em>,
such that <code class="literal">(array-&gt;vector <em class="replaceable"><code>array</code></em>)</code> and
<code class="literal">(array-&gt;vector <em class="replaceable"><code>narray</code></em>)</code> are equivalent.
I.e. the <em class="replaceable"><code>i</code></em>’th element in row-major-order of <em class="replaceable"><code>narray</code></em>
is the <em class="replaceable"><code>i</code></em>’th element in row-major-order of <em class="replaceable"><code>array</code></em>.
Hence <code class="literal">(array-size <em class="replaceable"><code>narray</code></em>)</code> (as specied from the <em class="replaceable"><code>shape</code></em>)
must be equal to <code class="literal">(array-size <em class="replaceable"><code>array</code></em>)</code>.
The resulting <em class="replaceable"><code>narray</code></em> is a view such that modifying <em class="replaceable"><code>array</code></em>
also modifies <em class="replaceable"><code>narray</code></em> and vice versa.
</p>
          </blockquote>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873570224" class="indexterm"/> <code class="function">share-array</code> <em class="replaceable"><code>array</code></em> <em class="replaceable"><code>shape</code></em> <em class="replaceable"><code>proc</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Returns a new array of <em class="replaceable"><code>shape</code></em> shape that shares elements of <em class="replaceable"><code>array</code></em>
through <em class="replaceable"><code>proc</code></em>. The procedure <em class="replaceable"><code>proc</code></em> must implement an affine
function that returns indices of <em class="replaceable"><code>array</code></em> when given indices of the
array returned by <code class="literal">share-array</code>.
The array does not retain a reference to <em class="replaceable"><code>shape</code></em>.
</p>
            <pre class="screen">(define i_4
   (let* ((i (make-array
                (shape 0 4 0 4)
                0))
          (d (share-array i
                (shape 0 4)
                (lambda (k)
                   (values k k)))))
      (do ((k 0 (+ k 1)))
          ((= k 4))
         (array-set! d k 1))
      i))
</pre>
            <p>Note: the affinity requirement for <em class="replaceable"><code>proc</code></em> means that each value must
be a sum of multiples of the arguments passed to <em class="replaceable"><code>proc</code></em>, plus a constant.
</p>
            <p>Implementation note: arrays have to maintain an internal index mapping
from indices <em class="replaceable"><code>k1</code></em> ... <em class="replaceable"><code>kd</code></em> to a single index into a backing vector;
the composition of this mapping and <em class="replaceable"><code>proc</code></em> can be recognised
as <code class="literal">(<em class="replaceable"><code>+ n0</code></em> (* <em class="replaceable"><code>n1</code></em> <em class="replaceable"><code>k1</code></em>) ... (* <em class="replaceable"><code>nd</code></em> <em class="replaceable"><code>kd</code></em>))</code>
by setting each index in turn to 1 and others to 0,
and all to 0 for the constant term; the composition can then be compiled
away, together with any complexity that the user introduced in their
procedure.
</p>
            <p>Here is an example where the <em class="replaceable"><code>array</code></em> is a uniform vector:
</p>
            <pre class="screen">(share-array
  (f64vector 1.0 2.0 3.0 4.0 5.0 6.0)
  (shape 0 2 0 3)
  (lambda (i j) (+ (* 2 i) j)))
  ⇒  #2f64((1.0 2.0 3.0) (4.0 5.0 6.0))
</pre>
          </blockquote>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873554880" class="indexterm"/> <code class="function">array-flatten</code> <em class="replaceable"><code>array</code></em></p>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873552048" class="indexterm"/> <code class="function">array-&gt;vector</code> <em class="replaceable"><code>array</code></em></p>
        <div class="blockquote">
          <blockquote class="blockquote">
            <p>Return a vector consisting of the elements of the <em class="replaceable"><code>array</code></em>
in row-major-order.
</p>
            <p>The result of <code class="literal">array-flatten</code> is fresh (mutable) copy, not a view.
The result of <code class="literal">array-&gt;vector</code> is a view: If <em class="replaceable"><code>array</code></em> is mutable,
then modifying <em class="replaceable"><code>array</code></em> changes the flattened result and vice versa.
</p>
            <p>If <em class="replaceable"><code>array</code></em> is “simple”,  <code class="literal">array-&gt;vector</code> returns the original vector.
Specifically, if <em class="replaceable"><code>vec</code></em> is a vector then:
</p>
            <pre class="screen">(eq? <em class="replaceable"><code>vec</code></em> (array-&gt;vector (array-reshape <em class="replaceable"><code>vec</code></em> <em class="replaceable"><code>shape</code></em>)))
</pre>
          </blockquote>
        </div>
      </section>
      <section class="sect2" title="Miscellaneous" epub:type="division" id="idm139667873542560">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title">Miscellaneous</h3>
            </div>
          </div>
        </div>
        <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873541488" class="indexterm"/> <code class="function">format-array</code> <em class="replaceable"><code>value</code></em> [<em class="replaceable"><code>element-format</code></em>]</p>
      </section>
    </section>
    <footer>
      <div class="navfooter">
        <ul>
          <li>
            <b class="toc">
              <a href="Arrays.xhtml#idm139667873857328">Array shape</a>
            </b>
          </li>
          <li>
            <b class="toc">
              <a href="Arrays.xhtml#idm139667873795792">Array types</a>
            </b>
          </li>
          <li>
            <b class="toc">
              <a href="Arrays.xhtml#idm139667873776720">Array literals and printing</a>
            </b>
          </li>
          <li>
            <b class="toc">
              <a href="Arrays.xhtml#idm139667873733232">Array construction</a>
            </b>
          </li>
          <li>
            <b class="toc">
              <a href="Arrays.xhtml#idm139667873697328">Array indexing</a>
            </b>
          </li>
          <li>
            <b class="toc">
              <a href="Arrays.xhtml#idm139667873642576">Modifying arrays</a>
            </b>
          </li>
          <li>
            <b class="toc">
              <a href="Arrays.xhtml#idm139667873610672">Transformations and views</a>
            </b>
          </li>
          <li>
            <b class="toc">
              <a href="Arrays.xhtml#idm139667873542560">Miscellaneous</a>
            </b>
          </li>
        </ul>
        <p>
          Up: <a accesskey="u" href="Data-structures.xhtml">Data structures</a></p>
        <p>
        Previous: <a accesskey="p" href="Streams.xhtml">Streams - lazy lists</a></p>
        <p>
        Next: <a accesskey="n" href="Hash-tables.xhtml">Hash tables</a></p>
      </div>
    </footer>
  </body>
</html>
